home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 028a / managr02.zip / AUTOXC40.BAS < prev    next >
BASIC Source File  |  1991-12-30  |  5KB  |  255 lines

  1. chngauto:
  2. cls
  3. print "View or Change Your AUTOEXEC.BAT file."
  4. print
  5. print
  6. print "On which drive is your AUTOEXEC.BAT"
  7. input "file";drive$
  8.  
  9. redrivea:
  10. drive$=drive$+"\"
  11. if drive$="a:\" then file1$="a:\autoexec.bat"
  12. if drive$="A:\" then file1$="a:\autoexec.bat"
  13. if drive$="b:\" then file1$="b:\autoexec.bat"
  14. if drive$="B:\" then file1$="b:\autoexec.bat"
  15. if drive$="c:\" then file1$="c:\autoexec.bat"
  16. if drive$="C:\" then file1$="c:\autoexec.bat"
  17. if drive$="d:\" then file1$="d:\autoexec.bat"
  18. if drive$="D:\" then file1$="d:\autoexec.bat"
  19. if drive$="e:\" then file1$="e:\autoexec.bat"
  20. if drive$="E:\" then file1$="e:\autoexec.bat"
  21.  
  22. if drive$="a:\" then file2$="a:\autoexec.bak"
  23. if drive$="A:\" then file2$="a:\autoexec.bak"
  24. if drive$="b:\" then file2$="b:\autoexec.bak"
  25. if drive$="B:\" then file2$="b:\autoexec.bak"
  26. if drive$="c:\" then file2$="c:\autoexec.bak"
  27. if drive$="C:\" then file2$="c:\autoexec.bak"
  28. if drive$="d:\" then file2$="d:\autoexec.bak"
  29. if drive$="D:\" then file2$="d:\autoexec.bak"
  30. if drive$="e:\" then file2$="e:\autoexec.bak"
  31. if drive$="E:\" then file2$="e:\autoexec.bak"
  32.  
  33. automenu:
  34. cls
  35. print "You have the following options:"
  36. print
  37. print
  38. print "1- Just view the AUTOEXEC.BAT file."
  39. print
  40. print "2- Add lines to the end of your file."
  41. print
  42. print "3- Create a new AUTOEXEC.BAT file."
  43. print
  44. print "4- Return to the Main Options Menu."
  45. print
  46. print
  47. print "Please press the number corresponding"
  48. print "to your choice, and then press Enter. ",chngauto$
  49.  
  50. if chngauto$="1" then
  51. cls
  52. gosub autolook
  53. goto automenu
  54. elseif chngauto$="2" then
  55. cls
  56. gosub appndaut
  57. gosub autolook
  58. goto  automenu
  59. elseif chngauto$="3" then
  60. cls
  61. goto newauto
  62. elseif chngauto$="4" then
  63. cls
  64. goto finish
  65. else
  66. goto automenu
  67. end if
  68.  
  69.  
  70. 'This routine creates a new AUTOEXEC.BAT file.
  71.  
  72. newauto:
  73. cls
  74. open file1$ for input as 1
  75. open file2$ for output as 2
  76. while not eof(1)
  77. line input # 1, a$
  78. print # 2, a$
  79. wend
  80. close # 1
  81. close # 2
  82. kill file1$
  83. cls
  84. print "Your AUTOEXEC.BAT file has been"
  85. print "changed to AUTOEXEC.BAK in order to"
  86. print "save it for later use.  To use it"
  87. print "later, you will have to rename it"
  88. print "AUTOEXEC.BAT after renaming your new"
  89. print "AUTOEXEC.BAT to something else (for"
  90. print "example, AUTOEXEC.X)."
  91. print
  92. print
  93. print "Press any key to continue. ";
  94. gosub presskey
  95.  
  96. scndchng:
  97. cls
  98. open file1$ for output as 1
  99. print "Please type the first line you want,"
  100. print "then press Enter (Q to quit).
  101. print
  102. input "> ",firstln$
  103.  
  104. if firstln$="q" then
  105. goto nochange
  106. elseif firstln$="Q" then
  107. goto nochange
  108. end if
  109.  
  110. print # 1, firstln$
  111.  
  112. contline:
  113. print
  114. print "Please type your next line, followed"
  115. print "followed by Enter (Q to quit)."
  116. print
  117. input "> ",nextline$
  118.  
  119. if nextline$="q" then
  120. goto stopchng
  121. elseif nextline$="Q" then
  122. goto stopchng
  123. end if
  124.  
  125. print # 1, nextline$
  126. goto contline
  127.  
  128. stopchng:
  129. close # 1
  130. cls
  131. gosub autolook
  132. print
  133. print
  134. print
  135. print "If this is not O.K. AND you want to"
  136. print "change it, press C and then Enter."
  137. print
  138. print "To restore your original AUTOEXEC.BAT,"
  139. print "press R and then Enter."
  140. print
  141. print "If you're happy with it as is, type OK"
  142. input "and Enter. ",changeyn$
  143.  
  144. rechange:
  145. if changeyn$="c" then
  146. goto scndchng
  147. elseif changeyn$="C" then
  148. goto scndchng
  149. elseif changeyn$="r" then
  150. goto nochange
  151. elseif changeyn$="R" then
  152. goto nochange
  153. elseif changeyn$="ok" then
  154. goto automenu
  155. elseif changeyn$="OK" then
  156. goto automenu
  157. elseif changeyn$="oK" then
  158. goto automenu
  159. elseif changeyn$="Ok" then
  160. goto automenu
  161. end if
  162.  
  163. print
  164. input "You must choose C, R, or OK. ",changeyn$
  165. goto rechange
  166.  
  167. nochange:
  168. cls
  169. reset
  170. kill file1$
  171. open file2$ for input as 1
  172. open file1$ for output as 2
  173. while not eof(1)
  174. line input # 1, a$
  175. print # 2, a$
  176. wend
  177.  
  178. reset
  179. print "Your original AUTOEXEC.BAT file has"
  180. print "been restored."
  181. print
  182. print
  183. print "Press any key to continue. ";
  184. gosub presskey
  185. goto automenu
  186.  
  187. 'This is the end of the routine for working with the AUTOEXEC.BAT file in 40c.
  188.  
  189.  
  190. 'Here is the routine for looking at the AUTOEXEC.BAT file in 40-column mode.
  191.  
  192. autolook:
  193. cls
  194. reset
  195. print "Here is your file:"
  196. print
  197. print
  198. open file1$ for input as 1
  199. while not eof(1)
  200. line input # 1, a$
  201. print a$
  202. wend
  203. close # 1
  204. print
  205. print
  206. print "Press any key to continue. ";
  207. gosub presskey
  208. return
  209.  
  210. 'This is the end of the routine for looking at the AUTOEXEC.BAT file in 40cols
  211.  
  212.  
  213. 'Here is the routine for adding lines to the end of AUTOEXEC.BAT.
  214.  
  215. appndaut:
  216. cls
  217. reset
  218. open file1$ for append as 1
  219.  
  220. appndagn:
  221. print
  222. print "Line to add (Q to quit)?"
  223. print
  224. input "> ",appendln$
  225.  
  226. if appendln$="q" then
  227. close # 1
  228. return
  229. elseif appendln$="Q" then
  230. close # 1
  231. return
  232. end if
  233.  
  234. print # 1, appendln$
  235. goto appndagn
  236.  
  237. 'This is the end of the routine for adding to the end of AUTOEXEC.BAT in 40col
  238.  
  239.  
  240. 'Here is the routine for continuing when the user presses a key.
  241.  
  242. presskey:
  243. wait:
  244. a$=inkey$
  245. if a$="" then goto wait
  246. return
  247.  
  248. 'This is the end of the routine for continuing when the user presses a key.
  249.  
  250.  
  251. 'Here is the routine for ending the program.
  252.  
  253. finish:
  254. end
  255.